{% extends '/pg/index.html' %}
{% block operation %}
<ul class="breadcrumb">
  <li><a href="/pg">Home</a></li>
  <li><a href="/pg/rilevazioni">Rilevazioni</a></li>
  <li class="active">Elenco Rilevazioni</li>
</ul>
<h2 class="text-center">Elenco rilevazioni</h2>

{% include "pg/btn_action.html" with context %}

{% include "pg/filterkey/fk_paginastatica.html" with context %}

<h2>Ci sono {{pageData["numero_daos"]}} inserimenti</h2>

 <div class="table-responsive">
    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th>Data</th>
                <th>Categoria</th>
                <th>Comune</th>
                <th>JSON ()</th>
            </tr>
        </thead>
        <tbody>
            {% for dao in pageData['daos'] %}
                <tr>
                    <td>{{dao.data_inserimento|datetimeformat}}</td>
                    <td>{{dao.categoria}}</td>
                    <td>{{dao.comune}}</td>
                    <td><a href="#" class="json_a" id="{{dao.id}}" ><img src="/tpl/img/json.png" width="30" height="30" alt="JSON"></img></a></td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    </div>

{%endblock%}
{% block custom_js %}
<script type="text/javascript">
$(document).ready(function () {
    $(".Preview").hide()
$("#anteprima").hide()
$(".Edit_dao").hide()
$("#edit_dao").hide()
$("#print_dao").hide()

$('#tableContainer_ac').jtable({
    title: 'Tabella Utente',
    messages: window.italianMessages,
    defaultDateFormat:"dd-mm-yy",
    paging: true,
    pageSize: 20,
    sorting: true,
    selecting: true,
    create:false,

    actions: {
        listAction: '/pg/ac_Rilevazioni/List',
        deleteAction: '/pg/ac_Rilevazioni/Delete'
    },
    fields: {
        id: {key: true, create: false, edit: false, list: false },
        data_inserimento: {
            title: 'Data Inserimento',
            width: '4%',
        },
        ente: {
            title: 'Ente',
            width: '4%',
        },
        categoria: {
            title: 'Categoria',
            width: '4%',
        },

        catalogo: {
            title: 'Catalogo',
            width: '4%',
        },
    },
    selectionChanged: function () {
    //Get all selected rows

    var $selectedRows = $('#tableContainer_ac').jtable('selectedRows');
    $("#anteprima").hide();
    $('.Preview').empty();
    $("#print_dao").hide();
    $("#edit_dao").hide();

    if ($selectedRows.length > 0) {
        //Show selected rows
        //$("#edit_dao").show()
        $("#anteprima").show()
        //$("#print_dao").show()

    }
},

}); //fine tabella


$('#tableContainer_ac').jtable('load');


$('#anteprima').attr('preview', '/pg/ac_Rilevazioni/Preview');












$(".json_a").click(function(e){

    var daoid = $(this).attr("id")
    //alert(daoid);
    $('.json_view'+daoid).toggle(200);
      });

});
</script>
{% endblock %}
<!--
<div class="pippo json_view{{dao.id}}" id="{{dao.id}}"></tr>-->
